home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine PD Edition 0
/
Amoszine PD Edition 0.adf
/
SOURCE_CODE
/
Cool_text.AMOS
/
Cool_text.amosSourceCode
Wrap
AMOS Source Code
|
1993-09-09
|
8KB
|
265 lines
'This a program I never reallty finished properly
'OK it's badly written but there may be a few useful routines
'in there! If you add more options and can get it to work when
'compiled (it crashes on me, think its because of the RAM DISK)
'then send me a copy please
'================================================================
Set Buffer 200
If Not Exist("RAM:") Then Print "no ram: disk" : Wait Key
Close Editor
Screen Open 0,640,256,16,Hires : Curs Off : Paper 0 : Cls 0
Colour 19,$111 : Colour 18,$EEE : Colour 17,$BBB
Global A$,F$,BL,BS,FL,K$,A$,LIN,KK,B$
FL=0
'==================================
MEN:
Reserve Zone 16 : Paper 0 : Pen 5 : Cls 0
Draw 0,165 To 640,165
Draw 0,177 To 640,177
'
Draw 0,181 To 640,181
Draw 0,193 To 640,193
'
Draw 0,197 To 640,197
Draw 0,209 To 640,209
Locate 0,0 : Pen 12 : Under On : Centre "COOL TEXT V1.0 By StEvE ByE (Mar 94)" : Under Off
Pen 5
Locate 27,6 : Print Border$(Zone$("LOAD",1),1)
Pen 14
Locate 33,6 : Print Border$(Zone$("SAVE",13),1)
Pen 4
Locate 51,6 : Print Border$(Zone$("EXIT",5),1)
Pen 1
Locate 45,6 : Print Border$(Zone$("HELP",7),1)
Pen 8
Locate 39,6 : Print Border$(Zone$("VIEW",12),1)
'
'
Pen 15
Locate 22,3 : Print Border$(Zone$("CLEAN",4),1)
Locate 11,3 : Print Border$(Zone$("COOL TEXT",3),1)
Locate 29,3 : Print Border$(Zone$("ALL CAPS",8),1)
Locate 39,3 : Print Border$(Zone$("LOWER CASE",9),1)
Locate 51,3 : Print Border$(Zone$("CYPHER",10),1)
Locate 59,3 : Print Border$(Zone$("DE-CYPHER",11),1)
Pen 5 : _PP
KEE:
While Mouse Key=0 : Wend
KK=Mouse Zone
If FL=1 Then Goto PL
If KK>1 and KK<>5 and KK<>7 Then Pen 3 : Locate 25,19 : Print "LOAD A TEXT FILE FIRST!" : Wait 60 : Pen 5 : Locate 25,19 : Print Space$(25) : Goto MEN
PL:
If KK=1 Then _LOAD
If KK=3 and FL=1 Then _UPDOWN : _RAMSAVE : _RELOAD : Goto MEN
If KK=4 and FL=1 Then _CLEAN : _RAMSAVE : _RELOAD : Goto MEN
If KK=5 Then Erase 10 : Erase 11 : Stop
If KK=7 Then _HELP : Goto MEN
If KK=8 and FL=1 Then _ALLCAPS : _RAMSAVE : _RELOAD : Goto MEN
If KK=9 and FL=1 Then _ALLLOW : _RAMSAVE : _RELOAD : Goto MEN
If KK=10 and FL=1 Then _CYPHER : _RAMSAVE : _RELOAD : Goto MEN
If KK=11 and FL=1 Then _DECYPHER : _RAMSAVE : _RELOAD : Goto MEN
If KK=12 and FL=1 Then _SHOW : Goto MEN
If KK=13 and FL=1 Then _SAVE : Goto MEN
Goto KEE
'==================================
Procedure _LOAD
Erase 10 : Erase 11
F$=Fsel$("","","LOAD A TEXT FILE","")
If F$="" Then FL=0 : Pop Proc
If Exist(F$)=0 Then FL=0 : Bell : Pop Proc
Open In 1,F$ : BL=Lof(1)
Reserve As Data 10,BL
Reserve As Data 11,BL
A$=Input$(1,BL)
Close 1
Bload F$,10 : BS=Start(10) : BE=BS+BL-1
FL=1
_PP
End Proc
Procedure _OC
Locate 33,23 : Print "OPERATION COMPLETED " : Wait 100 :
Locate 33,23 : Print Space$(40)
End Proc
Procedure _SAVE
Dir$="df0:"
F$=Fsel$("","","save File","")
If F$="" Then Pop Proc
Bsave F$,Start(11) To Start(11)+BL
End Proc
Procedure _CLEAN
BE2=Start(11) : COUNT=0 : DEL=0 : FO=0 : NC=0
For A=BS To BS+BL
X=Peek(A)
If X<>10 Then NC=0 : Goto DU
If X=10 Then Inc NC
If X=10 and NC=>2 Then Inc DEL : Goto GK
DU:
Poke BE2+COUNT,X
GK:
Inc COUNT
Locate 33,23 : Print "CLEANING>";COUNT-2
Next A
Locate 33,23 : Print "DELETED ";DEL;" lines" : Wait 100
_OC
End Proc
Procedure _PP
Locate 0,21 : Print "FILE SPEC:";F$
Locate 0,23 : Print "FILE LENGTH=";BL
FR=Free
Locate 0,25 : Print "CHIP MEM=";Chip Free;" FAST MEM=";Fast Free;" WORK SPACE FREE";FR
End Proc
Procedure _UPDOWN
BE2=Start(11) : COUNT=0 : CAP=1
For A=BS To BS+BL
X=Peek(A)
If CAP=1 and X>=97 and X<=122 Then X=X-32 : Goto DU
If CAP=0 and X>=65 and X<=90 Then X=X+32
DU:
Poke BE2+COUNT,X : Inc COUNT
If CAP=1 Then CAP=0 : Goto FD
If CAP=0 Then CAP=1
Locate 33,23 : Print "COOLING>";COUNT-2
FD:
Next A
_OC
End Proc
Procedure _CYPHER
BE2=Start(11) : COUNT=0
For A=BS To BS+BL
X=Peek(A)
Inc X
Inc X
Inc X
DU:
Poke BE2+COUNT,X : Inc COUNT
Locate 33,23 : Print "CYPHERING>";COUNT-2
Next A
_OC
End Proc
Procedure _DECYPHER
BE2=Start(11) : COUNT=0
For A=BS To BS+BL
X=Peek(A)
Dec X
Dec X
Dec X
DU:
Poke BE2+COUNT,X : Inc COUNT
Locate 33,23 : Print "DE-CYPHERING>";COUNT-2
Next A
_OC
End Proc
Procedure _ALLCAPS
BE2=Start(11) : COUNT=0
For A=BS To BS+BL
X=Peek(A)
If X>=97 and X<=122 Then X=X-32
DU:
Poke BE2+COUNT,X : Inc COUNT
Locate 33,23 : Print "CAPPING>";COUNT-2
Next A
_OC
End Proc
Procedure _ALLLOW
BE2=Start(11) : COUNT=0
For A=BS To BS+BL
X=Peek(A)
If X>=65 and X<=90 Then X=X+32
DU:
Poke BE2+COUNT,X : Inc COUNT
Locate 33,23 : Print "LOWER CASING>";COUNT-2
Next A
_OC
End Proc
Procedure _STRIP
BE2=Start(11) : COUNT=0 : DEL=0
For A=BS To BS+BL
X=Peek(A)
If X>=33 and X<=127 Then Goto DU
Inc DEL : Goto GK
DU:
Poke BE2+COUNT,X
GK:
Inc COUNT
Locate 33,23 : Print "STRIPING>";COUNT-2
Next A
Locate 33,23 : Print "DELETED ";DEL;" CHARS" : Wait 100
_OC
End Proc
Procedure _SHOW
Cls : PAGE=0 : LIN=0
For A=1 To BL
R$=Mid$(A$,A,1)
If Y Curs=>30 Then Vscroll 3 : Locate ,29
If X Curs=80-RMARGIN Then Locate LMARGIN,Y Curs+1
If Asc(R$)=9 Then Print Tab$; : Goto MORE
If Asc(R$)=10 Then Locate LMARGIN,Y Curs+1 : Inc LIN : Goto MORE
Print R$;
MORE:
If LIN>=25 Then Inc PAGE : Gosub UPD : LIN=0 : Home
Next A
Gosub UPD
Pop Proc
UPD:
Paper 2 : Pen 4 : Locate 0,27 : Print "PAGE:";PAGE;" PRESS RIGHT MOUSE BUTTON CONTINUE OR LEFT MOUSE TO EXIT "
Paper 0 : Pen 5 : Home :
J:
While Mouse Key=0 : Wend
If Mouse Key=1 Then Pop Proc
If Mouse Key=2 Then Cls 0 : Return
Goto J
End Proc
Procedure _HELP
Cls 13 : Paper 13 : Pen 0 : Home
Under On : Pen 2 : Centre "CoOl TeXt V1.0 S.Bye Feb 1994" : Under Off
Print : Pen 5 : Print : Centre "This program is DISKWARE, If you like it or want to keep it"
Print : Centre "then please send me a disk of good P.D utils/games."
Print : Centre "The AMOS source code is available for just �3.00 a disk and SAE."
Print
Pen 0 : Print : Centre " 1) First you must load A text file, click on LOAD to do this."
Print : Print : Centre " 2) Click on VIEW to check it is the file you want to process."
Print : Print : Centre " 3) You now have six options along the very top of the screen, which are:"
Print
Print : Centre " 4) COOL TEXT, ThIs CoNvErTs ThE FiLe To ThIs FoRmAt, To ImPrEsS YoUr MaTeS."
Print
Print : Centre " 5) CLEAN, This removes excess blank lines making long documents a lot"
Print : Centre " shorter, Cooltext scans for two or more blank lines consecutively and"
Print : Centre " deletes all but one, this can save reams of paper on P.D doc files etc."
Print
Print : Centre " 6) ALL CAPS, Converts all the text to capital letters."
Print
Print : Centre " 7) LOWER CASE, Converts all the text to Lower case letters."
Print
Print : Centre " 8) CYPHER, Encodes a text file so as to be unreadable in normal circumstances."
Print
Print : Centre "9) DE-CYPHER, Decodes a Cyphered file back to normal."
Print : Print : Centre "10) SAVE, is fairly obvious, click on this to SAVE your processed file to disk."
Print : Print : Inverse On : Centre "Steve Bye, 31 Wellington rd, Exeter, Devon. EX2-9DU" : Inverse Off
'
'
Pen 3 : Print : Print : Centre "press a mouse key"
While Mouse Key=0 : Wend
Pen 0
End Proc
Procedure _RAMSAVE
Dir$="RAM:" : F$="text.txt"
Bsave F$,Start(11) To Start(11)+BL
End Proc
Procedure _RELOAD
Erase 10
Erase 11
Dir$="RAM:"
Open In 1,F$ : BL=Lof(1)
Reserve As Data 10,BL
Reserve As Data 11,BL
A$=Input$(1,BL)
Close 1
Bload F$,10 : BS=Start(10) : BE=BS+BL-1
Locate 0,21 : Print F$ : FL=1
Locate 0,22 : Print "length=";BL
Kill F$
End Proc
Procedure _RAINING
Set Rainbow 2,0,100,"","","(9,1,1)" : Rainbow 2,0,46,100
Set Rainbow 1,0,30,"(3,1,1)","","" : Rainbow 1,0,175,30
End Proc